package lastRites.game.networking;

import java.util.logging.Level;
import java.util.logging.Logger;

import lastRites.game.networking.NetworkPackets.LoginResponse;
import lastRites.game.networking.NetworkPackets.PlayerMovementRequest;
import lastRites.game.networking.NetworkPackets.PlayerMovementResponse;

import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Listener;

/** This Listener just affirms whatever the player wants.
 * @author Eric */
public class SinglePlayerServerListener extends Listener {
	Logger	logger	= Logger.getLogger( "SinglePlayerServerListener" );

	@Override
	public void received(Connection connection, Object object) {
		logger.setLevel( Level.OFF );
		if( object instanceof NetworkPackets.LoginRequest ) {
			connection.sendTCP( new LoginResponse( true ) );
			Network.sendMap();
		}
		if( object instanceof PlayerMovementRequest ) {
			connection.sendTCP( new PlayerMovementResponse( true ) );
		}
	}
}